Skip to content

feat(api): add spec.volumes to Workspace for mounting additional volumes#921

Closed
knechtionscoding wants to merge 1 commit intokelos-dev:mainfrom
datagravity-ai:feat/workspace-volumes
Closed

feat(api): add spec.volumes to Workspace for mounting additional volumes#921
knechtionscoding wants to merge 1 commit intokelos-dev:mainfrom
datagravity-ai:feat/workspace-volumes

Conversation

@knechtionscoding
Copy link
Copy Markdown
Contributor

@knechtionscoding knechtionscoding commented Apr 6, 2026

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a new optional spec.volumes field to the Workspace CRD, allowing users to mount additional volumes (PVCs, ConfigMaps, Secrets, EmptyDirs) into the agent container.

This enables use cases like:

  • Mounting a PVC with pre-populated node_modules or other dependency caches
  • Attaching ReadOnlyMany volumes with large shared datasets or model weights
  • Injecting configuration via ConfigMap or Secret volumes

User-defined volumes are supplementary — the workspace EmptyDir is unchanged and the repo is always freshly cloned for isolation.

Changes:

  • api/v1alpha1/workspace_types.go: New WorkspaceVolume type and Volumes field on WorkspaceSpec
  • internal/controller/job_builder.go: Appends user volumes to pod spec and mounts them into the agent container
  • internal/controller/job_builder_test.go: 4 new tests (single PVC, multiple volumes, volumes + plugins, empty volumes backward compat)
  • examples/12-workspace-with-volumes/: Example workspace with a PVC volume
  • Generated: deepcopy, CRD manifests, client code via make update

Which issue(s) this PR is related to:

Part of #774

This is the first of two PRs for #774. The second PR will add spec.setup (init containers) which will also receive these volume mounts.

Special notes for your reviewer:

  • WorkspaceVolume.Source uses the Kubernetes-native corev1.VolumeSource type directly, so no custom volume abstraction is needed. Restricting volume source types (e.g. disallowing hostPath) is left to cluster admission policy, consistent with how most operators handle this.
  • Both fields are optional with zero-value defaults — existing Workspace resources work identically with no migration.

Does this PR introduce a user-facing change?

Add `spec.volumes` field to Workspace CRD for mounting additional volumes (PVCs, ConfigMaps, Secrets) into the agent container.

Summary by cubic

Adds an optional spec.volumes to the Workspace CRD so users can mount extra volumes (PVC, ConfigMap, Secret, EmptyDir) into the agent container. The default workspace EmptyDir and fresh clone remain unchanged; part of #774.

  • New Features

    • CRD: add WorkspaceVolume and spec.volumes using corev1.VolumeSource; enforce unique names and reserve "workspace" and "kelos-plugin".
    • Controller: append user volumes to the pod and mount them in the agent container.
    • Tests: cover single/multiple volumes, with plugins, and an explicit empty list for backward compatibility.
    • Examples: add examples/12-workspace-with-volumes/ and examples/15-workspace-with-setup/.
    • Manifests: regenerate CRD YAML in chart and install bundles; update deepcopy.
  • Bug Fixes

    • CLI/Helm tests: match only real :latest image refs using a regex to avoid false positives from CRD descriptions.

Written for commit 9021205. Summary will update on new commits.

@knechtionscoding knechtionscoding marked this pull request as ready for review April 6, 2026 16:19
@knechtionscoding knechtionscoding force-pushed the feat/workspace-volumes branch from c85a39a to 9ac4b87 Compare April 6, 2026 16:29
@gjkim42 gjkim42 self-assigned this Apr 7, 2026
@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature and removed needs-kind Indicates an issue or PR lacks a kind/* label labels Apr 15, 2026
Allow users to mount PVCs, ConfigMaps, Secrets, or EmptyDirs into the
agent container via workspace.spec.volumes. This enables use cases like
pre-populated dependency caches, shared datasets, and model weights
without requiring setup containers.

User-defined volumes are supplementary — the workspace EmptyDir is
unchanged and the repo is always freshly cloned for isolation.

fix: test using regex rather than :latest

Part of kelos-dev#774
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature needs-actor needs-priority needs-triage release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants